/* console.log(Symbol() === Symbol(), Symbol("foo") === Symbol("foo"));

// 提供了字符串与symbol值一一对应的关系
const s1 = Symbol.for("foo");
const s2 = Symbol.for("foo");
console.log(s1 === s2);
console.log(Symbol(true) === Symbol('true'))    // true

console.log(Symbol.iterator);
console.log(Symbol.hasInstance);

const obj = {
  [Symbol.toStringTag]: "XObject",
};

console.log(obj.toString()); */

const obj = {
  [Symbol()]: "symbol value",
  foo: "normal value",
};

// 通过forin，Object.key(), JSON.stringify() 会过忽略Symbol
for (const key in obj) {
  console.log(key);
}

// 通过Reflect.ownKeys, Object.getOwnPropertySymbols() 可以获取到对象上的Symbol值
console.log(
  Object.keys(obj),
  Reflect.ownKeys(obj),
  Object.getOwnPropertySymbols(obj)
);
console.log(JSON.stringify(obj));
